<? if ($c = stack('name')) {

	$d = component_data($c);

	?><section id="cpn-<?=$c?>" class="cpn-register"><?

			startScript('jquery, jquery.validationEngine, jquery.validationEngine-'.context('lang').', other-validations-'.context('lang').', jquery.maskedinput.min, jquery.linked_select, jquery.jstree, jquery.autocomplete, jquery.koatuudo, jquery.sbx');

			?><script type="text/javascript">
			
			$("#cpn-<?=$c?> form").validationEngine({
				ajaxFormValidation: true,
				onAjaxFormComplete: function ajaxValidationCallback(status, form, json, options){
					 
					if (status === true) {
						location.href = "/<?=$CONTEXT['lang_prefix']?>my/";
					}
				}
			});
			

			$("#low_index, #fact_index").masked("99999");
			/* $("#contactphone, #contactphone2").mask("(999)999-9999"); */

			$('#low_geo_id, #fact_geo_id').koatuudo({});

			</script><? endScript();
		
			?><form action="./" method="post">
				<h1><?=tc('Редагування особистих даних')?></h1>
				<p class="nb">(<?=gccUserInfo('email')?>)</p>
				<p class='nb'><?=tc("Символом <span class='required'>*</span> відмічені поля, обов'язкові для заповнення.")?></p>
				<fieldset>
					<div class="inner">
						<label class="col1"><?=tc('Назва організації:')?><span class="required">*</span>
							<input name="fullname" id="fullname" type="text" class="validate[required,custom[name_uk]]" value="<?=h(gccUserInfo('fullname'))?>"></label>

<!--						<div class="row">
							<label class="col2"><?=tc('Форма власності:')?><span class="required">*</span>
								<select name="ownership" id="ownership" class="validate[required]" value="<?=gccUserInfo('ownership')?>">
									<option value=""><?=tc('Undefined')?></option>
									<? foreach($d['ownership'] as $id => $v) {
										?><option <?= gccUserInfo('ownership') == $id ? 'selected' : '' ?> value="<?=$id?>"><?=$v?></option><?
									}?>
								</select></label>
							<label class="col2"><?=tc('ЄДРПОУ:')?><span class="required">*</span>
								<input name="edrpou" id="edrpou" type="text" class="validate[required,custom[integer],minSize[8],maxSize[10]] short" value="<?=h(gccUserInfo('okpo'))?>"></label>
						</div>
-->
						<div class="row">
							<label class="col2a"><?=tc('Форма власності:')?><span class="required">*</span>
								<select name="ownership" id="type" class="validate[required]" style="width:120px;"><option value=""><?=tc('Undefined')?></option><?
															foreach($d['ownership'] as $id => $v) {
															?><option <?= gccUserInfo('ownership') == $id ? 'selected' : '' ?> value="<?=$id?>"><?=$v?></option><?
															}
														?></select></label>
							<label class="col2b"><?=tc('ЄДРПОУ:')?><span class="required">*</span>
								<input name="edrpou" id="edrpou" type="text" class="validate[required,custom[integer],minSize[8],maxSize[10]] short" value="<?=h(gccUserInfo('okpo'))?>"></label>
						</div>


						<label class="col1"><?=tc('№ свідоцтва:')?><span class="required">*</span>
							<input name="certificatenumber" id="certificatenumber" type="text" class="validate[required]" value="<?=h(gccUserInfo('certificatenumber'))?>"></label>

					</div>

					<h2 class="legend"> <?=tc('Юридична адреса')?> </h2>

					<div class="inner">
						<label class="col1"><?=tc('Index')?><span class="required">*</span>
							<input name="low_index" id="low_index" type="text" class="validate[required,custom[integer],minSize[5], maxsize[5]] short" value="<?=h(gccUserInfo('low_index'))?>"></label>


						<label class="col0"><?=tc('Region, district, town')?><span class="required">*</span>
							<input name="low_geo_id" id="low_geo_id" type="text" class="validate[required]" value="<?=h(gccUserInfo('low_geo_id'))?>" data-title="<?=$d['low_geo_id_title']?>"></label>

						<label class="col1"><?=tc('Address')?><span class="required">*</span>
							<input name="low_address" id="low_address" type="text" class="validate[required]" value="<?=h(gccUserInfo('low_address'))?>"></label>
					</div>

					<h2 class="legend"> <?=tc('Фактична адреса')?> </h2>

					<div class="inner">
						<label class="col1"><?=tc('Index')?><span class="required">*</span>
							<input name="fact_index" id="fact_index" type="text" class="validate[required,custom[integer],minSize[5], maxsize[5]] short" value="<?=gccUserInfo('fact_index')?>"></label>

						<label class="col0"><?=tc('Region, district, town')?><span class="required">*</span>
							<input name="fact_geo_id" id="fact_geo_id" type="text" class="validate[required]" value="<?=h(gccUserInfo('fact_geo_id'))?>" data-title="<?=$d['fact_geo_id_title']?>"></label>

						<label class="col1"><?=tc('Address')?><span class="required">*</span>
							<input name="fact_address" id="fact_address" type="text" class="validate[required]" value="<?=h(gccUserInfo('fact_address'))?>"></label>

						<br><br>

						<div class="row">
							<div class="col1"><?=tc('Контактні телефони')?>
								<input name="contactphone" id="contactphone" class="validate[custom[phone_uk],maxSize[14]]" 
										 style="width:90px;" type="text" value="<?=h(gccUserInfo('contactphone'))?>" maxlength="14">
								<input name="contactphone2" id="contactphone2" type="text" class="validate[custom[phone_uk],maxSize[14]]" 
										 style="width:90px;" value="<?=h(gccUserInfo('contactphone2'))?>" maxlength="14">
							</div>
						</div>

					</div>

					<h2 class="legend"> <?=tc('Дані уповноваженої особи')?> </h2>

					<div class="inner">
						<label class="col1"><?=tc('Last Name')?><span class="required">*</span>
							<input name="lastname" id="lastname" type="text" class="validate[required,custom[fio_uk]]" value="<?=h(gccUserInfo('lastname'))?>"></label>
						<label class="col1"><?=tc('First name')?><span class="required">*</span>
							<input name="firstname" id="firstname" type="text" class="validate[required,custom[fio_uk]]" value="<?=h(gccUserInfo('firstname'))?>"></label>
						<label class="col1"><?=tc('Middle Name')?><span class="required">*</span>
							<input name="middlename" id="middlename" type="text" class="validate[required,custom[fio_uk]]" value="<?=h(gccUserInfo('middlename'))?>"></label>
						<label class="col1"><?=tc('Посада')?><span class="required">*</span>
							<input name="position" id="position" type="text" class="validate[required,custom[fio_uk]]" value="<?=h(gccUserInfo('position'))?>"></label>
					</div>

				</fieldset>

				<div class="div-right">
					<input type="submit" name="register" value="<?=htc('Save')?>">
<input type="button" name="back" value="<?=tc('Відмінити')?>" onclick="location.href = '/<?=$CONTEXT['lang_prefix']?>my/'">
				</div>

			</form><?

		?><div class="clearer"></div><?
	?></section><?

	unstack();
}
